﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace AuroraPlatform.ViewModel
{
    public abstract class NaviToParam
    {
        public string SourceUrl { get; set; }
        public string CurrentUrl { get; set; }
        public int NaviCount { get; set; }
        public NaviToParam Previous { get; set; }
        public NaviToParam Next { get; set; }
    }

    public class ParamIterator
    {
        public bool CanGoBack
        {
            get
            {
                return _current != null && _current.Previous != null;
            }
        }

        public void GoBack()
        {
            _current = _current.Previous;
            if (_current != null)
                _current.NaviCount++;
        }

        public bool CanGoForward
        {
            get
            {
                return _current != null && _current.Next != null;
            }
        }

        public void GoForward()
        {
            _current = _current.Next;
            if (_current != null)
                _current.NaviCount++;
        }

        public void GoNew(NaviToParam parameter)
        {
            if (_current == null)
            {
                _current = parameter;
            }
            else
            {
                parameter.Previous = _current;
                _current.Next = parameter;
                _current = parameter;
            }
        }

        private NaviToParam _current;
        public NaviToParam Current
        {
            get { return _current; }
        }
    }
}
